package com.zyj;

import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Version;

import java.io.IOException;

public class Lucene5MerageDemo {

    public static void main(String[] args) throws IOException {
        Directory directory = LuceneUtils.getDirectory(); //获取索引目录
        IndexWriterConfig indexWriterConfig = new IndexWriterConfig(Version.LUCENE_47, LuceneUtils.getAnalyzer());
        IndexWriter indexWriter = new IndexWriter(directory, indexWriterConfig);
        indexWriter.forceMergeDeletes();
        indexWriter.commit();
        indexWriter.close();
        System.out.println("合并完成");
        Lucene2FindDemo.findAll(LuceneUtils.getDirectory());
    }


}
